package cn.initcap.designpattern.pattern.behavioral.observer;

/**
 * 观察者模式
 *
 * @author initcap
 * @date Created in 2018/10/14 PM8:19.
 */
public class Test {

    public static void main(String[] args) {
        Course course = new Course("乡村教师.avi");
        Teacher teacher = new Teacher("苍也空井也空");

        course.addObserver(teacher);

        // 业务逻辑代码
        Question question = new Question();
        question.setUserName("initcap");
        question.setQuestionContent("如何才能学好各种姿势");

        course.produceQuestion(course, question);
    }

}
